
***********************************************************************************************************************
***********************************************************************************************************************
****************Figure 4: Individual-Level Evidence on Political Attitudes and Participation Preferences***************
***********************************************************************************************************************
***********************************************************************************************************************


use Data_ACC_survey.dta, clear

/*Delete invalid values*/
drop if f10b==9|f10b==8|f10c==9|f10c==8|f10d==9|f10d==8 


/*generate channel preference*/
gen b=.
replace b=1 if f10b==1
replace b=1 if f10b==3
replace b=0 if f10b==5

gen c=.
replace c=1 if f10c==1
replace c=1 if f10c==3
replace c=0 if f10c==5

gen d=.
replace d=1 if f10d==1
replace d=1 if f10d==3
replace d=0 if f10d==5

// channel preference: government only
gen govonly=0
replace govonly=. if b==.|c==.|d==.
replace govonly=1 if b==1 &c==0&d==0

// channel preference: government only
gen socialonly=0
replace socialonly=. if b==.|c==.|d==.
replace socialonly=1 if b==0 &c==0&d==1

/*generate age cohort*/
gen agecohort=0
replace agecohort=1 if yearofbirth>1958 /*1964-6(6 years old:Children are primarily affected through the education system)*/
replace agecohort=2 if yearofbirth>1972 /*1978-6*/

/*generate occupation type*/
gen worktype=.
replace worktype=1 if k2==1|k2==2|k2==3 /*Employed=1*/
replace worktype=5 if  k5==1|k5==2|k5==3|k5==6|k5==9 /*public or state sector=5*/

g decade=floor(yearofbirth/10)-190
recode decade (1 2 3 = 4) (9 10 = 8)
label def dc2 4 "1940s or before" 5 "1950s" 6 "1960s" 7 "1970s" 8 "1980s or after"
label val decade dc2

******* Plot Chanel Preferences ************

g polint_1=-c8c+5 if c8c<8 // know important problems of China
g polint_2=-c8d+5 if c8d<8 //know more about politics
g polint_3=-c8e+5 if c8e<8 // capable of participating
g polint_4= -d5a+4 if d5a<7 // Talk politics frequently
g polint_5= govonly // channel preference: government only
g polint_6= socialonly // channel preference: government only

***************** Export Tables *****************
eststo clear
reghdfe polint_1  thirdfront##decade   ccp  gender han    , a( survey provid edu k3) cl(cityid)
margins , dydx(thirdfront) over(decade) post
estimate store m1
estadd local ctrl "\(\checkmark\)"


reghdfe polint_2  thirdfront##decade   ccp  gender han    , a( survey provid edu k3) cl(cityid)
margins , dydx(thirdfront) over(decade) post
estimate store m2
estadd local ctrl "\(\checkmark\)"


reghdfe polint_3  thirdfront##decade   ccp  gender han    , a( survey provid edu k3) cl(cityid)
margins , dydx(thirdfront) over(decade) post
estimate store m3
estadd local ctrl "\(\checkmark\)"


reghdfe polint_4  thirdfront##decade   ccp  gender han    , a( survey provid edu k3) cl(cityid)
margins , dydx(thirdfront) over(decade) post
estimate store m4
estadd local ctrl "\(\checkmark\)"

reghdfe polint_5  thirdfront##decade   ccp  gender han    , a( survey provid edu k3) cl(cityid)
margins , dydx(thirdfront) over(decade) post
estimate store m5
estadd local ctrl "\(\checkmark\)"

reghdfe polint_6  thirdfront##decade   ccp  gender han    , a( survey provid edu k3) cl(cityid)
margins , dydx(thirdfront) over(decade) post
estimate store m6
estadd local ctrl "\(\checkmark\)"


esttab m*  using out.txt, nonote nobaselevels noomitted       eqlabels("Effect of Third Front for...")     b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01)  booktabs replace   varlabels(4.decade "Birth cohort: 1940s or earlier" 5.decade "Birth cohort: 1950s" 6.decade "Birth cohort: 1960s" 7.decade "Birth cohort: 1970s" 8.decade "Birth cohort: 1980s or later")  ///
nomtitles ///
mgroup("Know China's important problems" "Know more about politics than an average person" "Fully capable of participating in politics" "Talk to others about politics" "Channel preference: government" "Channel preference: social organization", pattern(1 1  1 1  1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(ctrl N, labels(  "Control variables"   "Observations") fmt(0  0) ) 




*************************************************************************************************************
************************************************************************************************************* 
****************Figure 5: Participation Propensity Among Migrants by Cohort *********************************
*************************************************************************************************************
*************************************************************************************************************


use Data_CMDS_survey.dta, clear

// generate Home city and decade 

g homecity=floor(hj_id/100)

g decade=floor(yearofbirth/10)-190
recode decade (1 2 3 = 4) (9 10 = 8)
label def dc2 4 "1940s or before" 5 "1950s" 6 "1960s" 7 "1970s" 8 "1980s or after"
label val decade dc2

/*results by cohort*/

eststo clear
reghdfe Q502A third##decade gender age minority edu hukou ccp   if q101l1<3  , a(Q207 Q206 edu    ) cl(homecity  )  
margins , dydx(third) over(decade) noestimcheck post
estimate store m1
estadd local ctrl "\(\checkmark\)"

reghdfe Q502B third##decade gender age minority edu hukou ccp    if q101l1<3  , a(Q207 Q206 edu    ) cl(homecity  )  
margins , dydx(third) over(decade) noestimcheck post
estimate store m2
estadd local ctrl "\(\checkmark\)"

reghdfe Q502E third##decade gender age minority edu hukou ccp    if q101l1<3  , a(Q207 Q206 edu    ) cl(homecity  )  
margins , dydx(third) over(decade) noestimcheck post
estimate store m4
estadd local ctrl "\(\checkmark\)"



esttab m1 m2 m4  using out.txt, nonote nobaselevels noomitted       eqlabels("Effect of Third Front for...")     b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01)  booktabs replace   varlabels(4.decade "Birth cohort: 1940s or earlier" 5.decade "Birth cohort: 1950s" 6.decade "Birth cohort: 1960s" 7.decade "Birth cohort: 1970s" 8.decade "Birth cohort: 1980s or later")  ///
nomtitles ///
mgroup("Making suggestions to workplace/community/neighborhood" "Making suggestions to government" "Participating in party and league activities", pattern(1 1 1 )  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(ctrl N, labels(  "Control variables"   "Observations") fmt(0  0) ) 


*****************************************************************************
*****************************************************************************
*******Table A.21: Gauging Grievances in TF Cities (CGSS 2005 & 2006)********
*******Table A.22: Gauging Grievances in TF Cities (ACC 2008 & 2009)*********
*****************************************************************************
*****************************************************************************

use Data_Grievances_survey.dta, clear

pca medicalservice elderservice eduservice securityservice crimeservice lawenforcementservice govservice environmentservice poorservice

predict  govservice_cgss2005


global cov age gender edu hukou ccp   minority

label var gender "Gender"
label var age "Age"
label var ccp "CCP member"
label var edu "Education"
label var hukou "Hukou"
label var minority "Ethnic"

label var thirdfront "Third Front city"

eststo clear
eststo m1: reg happiness1_cgss2005 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m2: reg happiness2_cgss2005 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m3: reg govservice_cgss2005 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"

eststo m4: reg workerrights_cgss2006 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m5: reg satisfaction_cgss2006 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m6: reg redistribution_cgss2006 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"



esttab m*  using out.txt, nonote nobaselevels keep(thirdfront $cov) order(thirdfront $cov) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
mtitles( "Happiness1" "Happiness2" "Goverment service" "Workers' rights" "Satisfaction" "Redistribution") ///
mgroup("2005" "2006", pattern(1 0 0 1 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(pf control r2_a  N, labels("Province FE" "Individual-level controls" "Adjusted R\(^2\)"  "Observations") fmt(0 0 2 0) )



eststo clear
eststo m7: reg gain_acc2008 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m8: reg redistribution_acc2008 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m9: reg satisfaction_acc2008 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m10: reg happiness_acc2008 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m11: reg trust_cengov_acc2008 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m12: reg trust_locgov_acc2008 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"




eststo m13: reg gain_acc2009 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m14: reg redistribution_acc2009 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m15: reg satisfaction_acc2009 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m16: reg happiness_acc2009 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m17: reg trust_cengov_acc2009 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"
eststo m18: reg trust_locgov_acc2009 thirdfront $cov i.provid,cl(cityid)
estadd local pf "\(\checkmark\)"


esttab m*  using out.txt, nonote nobaselevels keep(thirdfront $cov) order(thirdfront $cov) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
mtitles(  "Gain" "Redistribution"  "Satisfaction" "Happiness" "Trust central gov" "Trust local gov" "Gain" "Redistribution"  "Satisfaction" "Happiness" "Trust central gov" "Trust local gov") ///
mgroup("2008" "2009", pattern(1 0 0 0 0 0 1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(pf control r2_a  N, labels("Province FE" "Individual-level controls" "Adjusted R\(^2\)"  "Observations") fmt(0 0 2 0) )

